package swingxrcp.framework.server.service;

import java.io.Serializable;
import java.util.Collection;

import swingxrcp.framework.model.Page;
import swingxrcp.framework.model.domain.Entity;

/**
 * 持久化服务
 *
 * @author liangfei
 * @since 2008-10-26
 */
public interface PersistentService extends Service {

	void save(Entity entity);

	void batchSave(Collection<Entity> entities);

	void update(Entity entity);

	void batchUpdate(Collection<Entity> entities);

	void saveOrUpdate(Entity entity);

	void batchSaveOrUpdate(Collection<Entity> entities);

	void remove(Entity entity);

	void batchRemove(Collection<Entity> entities);

	void remove(Class<?> entityClass, Long id);

	void batchRemove(Class<?> entityClass, Collection<Long> entityIds);

	Entity get(Entity entity);

	Entity get(Class<?> entityClass, Long id);

	Entity get(Class<?> entityClass, String property, Serializable value);

	Collection<Entity> find(Entity entity);

	Collection<Entity> find(Class<?> entityClass, String property, Serializable value);

	Collection<Entity> find(String query);

	Page<Entity> findPage(Entity entity);

	Page<Entity> findPage(Class<?> entityClass, String property, Serializable value);

	Page<Entity> findPage(String query);

}
